<template>
  <view class="category">
    <view class="category-item" @tap="gotoCategory" v-for="item in list" :key="item.id">
      <image class="icon" :src="item.icon"></image>
      <text class="text">{{ item.name }}</text>
    </view>
  </view>
</template>

<script setup lang="ts">
import type { CategoryItem } from '@/types/home'

defineProps<{
  list: CategoryItem[]
}>()

const gotoCategory = () => {
  uni.switchTab({ url: '/pages/category/category' })
}
</script>
<style scoped lang="scss">
@import '@/styles/category.scss';
</style>
